<template>
  <el-dialog  :visible.sync="dialogVisible" width="80%" v-if="dialogVisible" :lock-scroll="true">
    <div class="scroll-wrapper">
      <components :is='article'></components>
      <div class="dialog-footer">
        <div class="btn" @click="dialogVisible=false">{{`我已阅读`}}</div>
      </div>
    </div>
  </el-dialog>
</template>
<script>
import Privacy from './components/Privacy'
import Protocol from './components/Protocol'

export default {
  name:'Dialog',
  props:['visible','type'],
  components:{
    Privacy,
    Protocol
  },
  computed:{
    article(){
      return this.type===0 ?  'Protocol':'Privacy'
    },
    dialogVisible:{
      get(){
        return this.visible
      },
      set(val){
        this.$emit('update:visible')
      }
    }
  },

}
</script>

<style lang="scss" scoped>

.el-dialog__wrapper{
  overflow: hidden;
  max-height: 100%;
  display: flow-root;
}


::v-deep .el-dialog{
  margin-bottom: 2rem;
}

.scroll-wrapper{
  max-height:100%;
  overflow-x: auto;
  overflow-y: scroll;
}

::v-deep .el-dialog__body{
  // display: flow-root;
  height:80vh!important;
  // padding-top: 0.05rem;
}

::v-deep .el-dialog__header{
  display: none;
}

.dialog-footer{
  height: 2rem;
  line-height: 2rem;
  display: flex;
  justify-content: center;
}

.dialog-title{
  margin: 0;
  font-weight: 700;
  font-size: .3rem;
  text-align: center;
}

.btn{
  width: 3.6rem;
  height: .59rem;
  background-color: #C69766;
  line-height: .59rem;
  text-align: center;
  color: #fff;
  font-size: .18rem;
  cursor: pointer;
}

::v-deep .article{
  line-height: 1.75;
  padding:0 .5rem;
  // letter-spacing: .01rem;

  .time{
    text-align: right;
    margin-top: 1rem;
    font-weight: 700;
    color: #000;
    font-size: .16rem;
    span{
      font-weight: 400;
      color: #666;
    }
  }

  h1{
    font-size: .32rem;
    font-weight: 700;
    text-align: center;
    color: #000;
    margin-bottom: .6rem;
  }

  strong{
    font-weight: 700;
    font-size: .18rem;
    color: #000;
  }

  p{
    color: #666;
    text-align: left;
    font-size: .16rem;
    margin: .18rem 0;
  }
}


</style>
